﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using DAO;

namespace WebApplication.Models
{
    public class NotificationModel
    {
        [Required]
        [Display(Name="Имя пользователя")]
        public string Name { get; set; }

        [Required]
        [DataType(System.ComponentModel.DataAnnotations.DataType.EmailAddress)]
        public string Email { get; set; }

        [Display(Name="Комментарий")]
        public string Description { get; set; }

        public static DAO.Notification ToEfEntity(NotificationModel not)
        {
            return new DAO.Notification
            {
                Name =not.Name,
                Email = not.Email,
                Description = not.Description
            };
        }

        public static NotificationModel ToModelEntity(DAO.Notification not)
        {
            return new NotificationModel
            {
                Name = not.Name,
                Email = not.Email,
                Description = not.Description,
            };
        }
    }
}